<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/3
 * Time: 10:31
 */

namespace App\Api\Admin\Controllers;
use  App\Models\AdminMenu;
use App\Models\MemberShip;
use App\Models\Shareholder;
Use App\Models\User;
use Illuminate\Database\Eloquent\Collection;

class TestController extends CommonController
{

    public function Index()
    {
        $collection = AdminMenu::select('title as name', 'id', 'parent_id','order','uri')->get()->toArray();
        $menu = (new AdminMenu)->getDepartments($collection);
        return json_success('ok', $menu);
    }

    public function users(){
        $list = User::where('status', 1)->orderBy('id')->chunk(100, function($users) {
            foreach ($users as $user) {
             echo $users;
            }
        });
    }

    public function UserSynchro()
    {
      $member_list = MemberShip::where(['status'=>1])->get();
       return json_success('ok',$member_list);
    }




}